package com.wangjie.pattern.singleton;

/**
 * 静态内部类
 *
 * 外部类装载时, 静态内部类不会被装载, 只有调用getInstance(), 才会装载SingletonInstance, 从而完成Singleton的实例化
 */
public class Singleton4 {
    private Singleton4() {

    }

    private static class SingletonInstance {
        private static final Singleton4 INSTANCE = new Singleton4();
    }

    public static Singleton4 getInstance() {
        return SingletonInstance.INSTANCE;
    }
}